From 220956ee03fa37fb55079aff63675db26cd908f9 Mon Sep 17 00:00:00 2001
From: Cristian KLEIN <cristiklein+gnome@gmail.com>
Date: Thu, 16 Dec 2010 17:38:06 +0000
Subject: libview: Stop the GtkSpinner when the loading window is hidden

Fixes bug #637390.
---
diff --git a/libview/ev-loading-window.c b/libview/ev-loading-window.c
index 4d5eaaf..434beac 100644
--- a/libview/ev-loading-window.c
+++ b/libview/ev-loading-window.c
@@ -33,6 +33,7 @@ struct _EvLoadingWindow {
 	GtkWindow  base_instance;
 
 	GtkWindow *parent;
+	GtkWidget *spinner;
 
 	gint       x;
 	gint       y;
@@ -69,7 +70,6 @@ ev_loading_window_init (EvLoadingWindow *window)
 	GtkWindow   *gtk_window = GTK_WINDOW (window);
 	GtkWidget   *widget = GTK_WIDGET (window);
 	GtkWidget   *hbox;
-	GtkWidget   *spinner;
 	GtkWidget   *label;
 	GtkStyle    *style;
 	GdkColor    fg, bg;
@@ -79,10 +79,9 @@ ev_loading_window_init (EvLoadingWindow *window)
 
 	hbox = gtk_hbox_new (FALSE, 12);
 
-	spinner = gtk_spinner_new ();
-	gtk_spinner_start (GTK_SPINNER (spinner));
-	gtk_box_pack_start (GTK_BOX (hbox), spinner, FALSE, FALSE, 0);
-	gtk_widget_show (spinner);
+	window->spinner = gtk_spinner_new ();
+	gtk_box_pack_start (GTK_BOX (hbox), window->spinner, FALSE, FALSE, 0);
+	gtk_widget_show (window->spinner);
 
 	label = gtk_label_new (loading_text);
 	gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
@@ -222,10 +221,22 @@ ev_loading_window_hide (GtkWidget *widget)
 
 	window->x = window->y = 0;
 
+	gtk_spinner_stop (GTK_SPINNER (window->spinner));
+
 	GTK_WIDGET_CLASS (ev_loading_window_parent_class)->hide (widget);
 }
 
 static void
+ev_loading_window_show (GtkWidget *widget)
+{
+	EvLoadingWindow *window = EV_LOADING_WINDOW (widget);
+
+	gtk_spinner_start (GTK_SPINNER (window->spinner));
+
+	GTK_WIDGET_CLASS (ev_loading_window_parent_class)->show (widget);
+}
+
+static void
 ev_loading_window_class_init (EvLoadingWindowClass *klass)
 {
 	GObjectClass   *g_object_class = G_OBJECT_CLASS (klass);
@@ -235,6 +246,7 @@ ev_loading_window_class_init (EvLoadingWindowClass *klass)
 	g_object_class->set_property = ev_loading_window_set_property;
 
 	gtk_widget_class->size_allocate = ev_loading_window_size_allocate;
+	gtk_widget_class->show = ev_loading_window_show;
 	gtk_widget_class->hide = ev_loading_window_hide;
 
 	g_object_class_install_property (g_object_class,
--
cgit v0.9
